package study.javaee.practice.common.exception;

import lombok.Getter;
import study.javaee.practice.common.api.ApiErrorCode;

/**
 * 自定义Api异常类
 */

@Getter
public class ApiException extends RuntimeException{
    // 应使用RuntimeException类的message和apiErrorCode的code
    ApiErrorCode apiErrorCode;

    ApiException(ApiErrorCode apiErrorCode, String message){
        super(message);
        this.apiErrorCode = apiErrorCode;
    }

    public ApiException(ApiErrorCode apiErrorCode){
        this(apiErrorCode, apiErrorCode.getMessage());
    }

}
